<!DOCTYPE html>

<html>

<head>
    <meta charset="utf-8">
    <title>医废追溯</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="../../layuiadmin/layui/css/my.css" media="all">

</head>

<body>
    <div class="layui-form" style="margin-left:20px;margin-top:15px;margin-bottom:-20px">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 120px;">废物箱条码编号：</label>
            <div class="layui-inline">
                <input class="layui-input" name="id" id="demoReload" autocomplete="off" placeholder="请输入条形码">
            </div>
            <button class="layui-btn layui-btn-normal" data-type="reload" id="serch"> <i class="layui-icon">&#xe615;</i>查询</button>

        </div>
    </div>
    <table id="demo" lay-filter="test"></table>
    <script src="../../layuiadmin/layui/layui.js"></script>
    <script>
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index']);
        layui.use('laydate', function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#datetime', //指定元素
                theme: "#1e9fff"
            });
        });

        layui.use('table', function() {
            var table = layui.table;
            var $ = layui.$;
            var tableIns = table.render({
                elem: '#demo',
                height: 'full',
                data: [],
                cols: [
                    [ //表头
                        {
                            field: 'name',
                            title: '医院名称',
                            width: '15%',
                            align: "center"
                        }, {
                            field: 'sno',
                            title: '废物箱条码',
                            width: '15%',
                            align: "center"

                        }, {
                            field: 'type',
                            title: '类别',
                            width: '10%',
                            templet: function(d) {
                                switch (d.type) {
                                    case "0":
                                        return "感染性废物";
                                        break;
                                    case "1":
                                        return "损伤性废物";
                                        break;
                                    case "2":
                                        return "利器盒";
                                        break;
                                    case "3":
                                        return "化学性废物";
                                        break;
                                    case "4":
                                        return "药物性废物";
                                        break;
                                    case "5":
                                        return "病理性废物";
                                        break;
                                    case "6":
                                        return "输液瓶";
                                        break;
                                    case "7":
                                        return "输液袋";
                                        break;
                                    default:
                                        return "";
                                        break;
                                }
                            },
                            align: "center"

                        }, {
                            field: 'pdate',
                            title: '收集日期',
                            width: '10%',
                            align: "center"
                        }, {
                            field: 'ctime',
                            title: '收集时间',
                            width: '15%',
                            align: "center"
                        }, {
                            field: 'area',
                            title: '关联科室',
                            width: '15%',
                            align: "center"
                        }, {
                            field: 'status',
                            title: '状态',
                            width: '15%',
                            templet: function(d) {
                                switch (d.status) {
                                    case "0":
                                        return "收集";
                                        break;
                                    case "1":
                                        return "入库";
                                        break;
                                    case "2":
                                        return "出库";
                                        break;
                                    default:
                                        return "";
                                        break;
                                }
                            },
                            align: "center"
                        }
                    ]
                ],
                skin: 'row' //表格风格
                    ,
                even: true
            });


            $("#serch").on('click', function() {
                tableIns.reload({
                    url: '../../../Box/ListCurr',
                    where: {
                        keyword: $("#demoReload").val()

                    } //设定异步数据接口的额外参数

                });
                $("table tr").css({
                    "background": "#1E9FFF",
                    "color": "white"
                });
            });
            $("table tr").css({
                "background": "#1E9FFF",
                "color": "white"
            });
        });
    </script>

</body>

</html>